Fix dangling marker problem.

Also, only run every 0.5s, and only if the contents have changed.
This makes it much more responsive.