Fix hint_text disappearing

Fixes #1690.

Also does some code cleanup.