tidied comments; fixed checkdata() and added handling of nulls in json
added config generation