alert: factorize the code