Added 'each' function, calling user-defined function on each cached element