refactored to conform to cake pattern