refactor deploy method.