Minor refactoring for pain.