Some refactoring.