caching added and error handling removed