cleaned up alert code