minor code consolidation with first unit test