Minor refactors and formatting.