improved notification code