Add Caching
Fix and add tests
Cleanup
Thread safety
Merge pull request #7 from Neob91/BUG_972

Bug 972