Major refactoring, remove redundant logic

* Remove redundant testing logic
* Add result sorting back in - turns out it was needed