refactor deploy/undeploy key