added support for to_hash and to_json