Added caching for times function