Cleaned up temp file management