Cancelling delayed function at stop invocation.

Plus a few other cleanups