New unit tests and tidy