Fixing a conversion bug and adding ability to output json