moving click event to update function