changes in control routine and pid controller