added cache to improve the performance