Fixed tests.
Minor refactor.