Subsidiary routine fixes + tests
Working with tests.