Added error handling and initial support for JSON and OCaml, better
refactoring for python supported data exports.