Refactor to use mktemp on deploy server