Minor refactor

Reorg of code