update data structure and error handling