Minor refactors and formatting changes for latest merges