unit tests and more goodness