Converted _tempWrite() into general usage writer

Note: The code is fully broken now, as the functions that call this are
not yet converted into OOP.