Refactor restore and deploys