Refactored to conform to modular pattern