Readding test
Minor refactoring.