Refactor the cmsdeploy task