added database caching