Checkpoint work on SimpleNmLinear.

Fix errors in logic, add test cases.