Refactor tooltip plugin