refactored caching layer
fixed errorprone variable initialization
Merge pull request #1 from metglobal/caching_revisited

refactored caching layer