proper cache implementation