refactor clickhandler