Refactored/added some tests.