Refactor deployments

I have added the patch I made the other night, but I haven't been able to test it properly on this machine!