simplify cached, as suggested by @philipnilsson