format previous (buggy) merge-sort implementation for record