more complex prototype with cache