Refactored tooltip code.