with caching in prereq queries