Fix annotator tests, refactor classes to make testable