Some cleanup, minor fixes and doc corrections