-added the main sort function and new setters