Change Notification callback to handler
This commit also introduces some general improvements, like explicitly specifying parameter types, using immutable defaults, and raising errors instead of printing them out, so the main code can choose to handle them.