added ability to set file extension