Factor out the notify stuff into separate module