optimised event handlers with element caching