implemented proper package sorter
implemented test for package sorter