API queries and a bit of JSON
some changes