some optimisation into caching