Some refactoring, etc.