Refactor deployment controller