refactored classes and modules to remove private functions to allow testing of all functionality