first commit of revised cache code
a few tweaks to the first