Cache clearing

This is an extension of the last PR.