Minor refactor and comments