some code changes and additions to the tests