Added caching classes
Refactored and added unit tests