Identify and group like terms (#261)