Termination algorithms