Fixed tempfile functionality, which is now fully functional.