Refactored and added test to Deploy