Refactor, doc fixes and updates