cleanups, write some docs