Refactored/simplified