refactored open/closed to a single method