Cleanup and half implemented the sorter