Refactor deployer and prepare factory