Refactore code. Remove repetitive code.
Fix unit test names.