Channed global termination condition to a trait.

Makes it possible to extend it, simplifies implementation.