Changed Notifier to call listener in attaching order.

Also, use an UniquePtr to store allocated handler and prevent memory leak.