cleanup, test fix and docs (still wip)