some fixes, cleanup, docblocks