adds improvements to sort functionality as of #50