Small changes and refactoring.