semi-functional again: beginning new refactor (I promise I'm getting better at this...)