adding cache functionality