Minor refactor to reduce complexity.