Export tmp

Logic changes for writing data to tmp files then moving them into place