added error handling and json key for the state of the site