Added better location lookup for errors
Added an error flag for faulty json/xml responses