Refactored for Efficiency