sort functionality; closes issue #1