Adding termination routine