A few utility functions and more tests.