Added cache functionality.