Refactored the reasoner so that it would be easier to test