Implemented merge sort