small changes

improved program stopping process