Refactor postDeploy script