Refactored for simplification