Refs #10026 fix algorithm and add unit and doc tests
Refs #10026 resolve conflict