Adding tests and refactoring to more of a class-based testable model
More refactoring and tests, and added Optimist