Minor refactor and cleanup