refactoring in merge operation and minor changes in other parts of lpms