Added cache support to speed up the process