Removed unused code, refactored notification processing.