Providing a stop function and cleaning up after itself