Some refactoring. Merge sort added.