Small fix and refactoring.