Minor refactors before merge with master