Working on sort refactor