improved deploy, undeploy and shell commands, code cleanup