Removed statics, added jUnit tests, fixed sorter