Added logic for cache checks