Added ability to choose output format