refactored for elegance