refactoring for tooltip handling