Added option to set output mode