Rewrote tests partly, docs fixing