worked out kinks with sort functionality