Added the terminate method.