Refactoring classification service so it's easier to test.