Make clear cache popup code more easily transferable to other functionality