more efficient cache clearing
renaming cache variables for clarity
merging in latest master