Refactored a lot of the testing code and added a method to validate each algorithm