Bug fixes and added support for json