Refactoring to add tests and cleanup code