Implement some more tests, add utility functions.