Merged sort and merge operation to it's own method