implemented simple cache for first pass