Smart task stopping.