added termination feature