function to manage notification