refactored out the testing code into a separate class