Add events and caching function