minor refactoring to remove some smell