file-writing is now reimplemented (and tested) to happen in separate threads; probably buggy, will need to test as part of the whole system.