Minor refactorings. Closes #3