Removed old file replace code and added temp file clean-up.