refactored deploy script