Added a sorting functionality and updated some JUnit Tests.