more improvements. added json-api-call function