Refactored output_format to return_format, added format param to methods.

Added tests for new functionality.