Added a routine that will cache stuff that costs a lot of queries.