Minor refactoring, etc.