Refactored deploy_source