more cleanup; fixed a bug when all the alerts were removed on hide; moved tracking setup into a separate function