Reorganize unit tests. A bit of refactoring.