added optimized code for mergePoint, applyPoint