Minor clean ups, new test cases for #137