Implemented splitting and merging selected loop.