DRY up caching code. There were three almost identical. Now one.