add cache for speedup