Refactored for testability. Updated messages. Completed tests.
Fixed lint.