Improved design, refactored code, and unit tests