Updated derivative code to clean up temp files.