Minor refactoring
Add test