Further refactor of notification processing code