Added clean up code to remove the tmp files