Added some tests and helper functionality.