Added logic for selectable output