added hierarchial merge-sort to manage max # open file descriptors in worst case scenarios