refactor heart beat alert