Updated to add a bit of indexes and caching