Added some caching for status and more robust error handling