Completed termination function