move notify to function