Cleanup, doc fixes and upstream changes