Moved classes out to their own files with interfaces for testing.