Add to and fix unit tests