Continue refactoring. Add simple test.