Replace operation, cleanup thread, and small edits
The rest of the stuff pertaining to the replace, threads, etc