Refactored for deployment