refactored caching layer

oops. nice shot. fixed.