Adds correct atomic file handling back after re-factoring