What are the constructive things our minds do when they wander?

And when does mindwandering cross over … into not-so-constructive territory?