Use const char* for tempfile rename
Remove lock suffix from tempfile
Pass rename to temp file when initialized
Move flags to tempfile
Gradually change function params to temp files