Added option to change output extension