add Stop and Terminate functions