WIP: hacking on some code to make caching easier