Added ability to automatically stop