More consistent OS Notification behaviour. Some code cleanup.