Implemented select for sorted merge but tested it terribly