Refactored to be more consistent with existing code structures