added cache functionality