Added required changes to doc and protection from nullptr.