Modularized the deploy functionality