Addition of prepare stage to split up the logic required for potential file creation and truncation.