Simplified merge sort and added documentation