Added helper method setOutputFormat and removed redundant comments

Added a helper method setOutputFormat that makes code more readable. Removed redundant comments from variable declarations.