refactoring deploy script to be more readable and useful