trying to clean up and prepare for refactoring with template and perhaps factory design method