Improved error reporting and test api key loading