hybrid sort function finished. all functions work correctly. next commit will delete redudant functions.