refactor deploying from server