first cut of refactoring
refactored