Add start and stop callback API.

this commit fixes #41