Adding smart termination mode.