On second thought, this needs more refactoring to be testable.