Adding cache functionality