get line inserts working properly and hook _write_temp up