Minor refactor and output format improvements