added merging of sublayouts with the same direction into simplification algorithm