Working Terminate function!

Signed-off-by: steefbrown <steefbrown@gmail.com>