extract alert handling to separate functions
replaced dynamic_cast with switch on alert type