Optimizing deployments