bunch of work

* mainly the write phase finished