Added code to support JSON output