improving notification logic