Functionality of 'on click' improved