Optional callbacks. Fixes #2.