Removed a lot of duplication in Notifier

Also, added tests for notifier