Removed unused functions, added temp file helper