Implementation of caching (alpha v0.1)