middle of refactoring after Nate's advice
refactored - Time for Nate Review