Finished tests, continuing refactoring.