added initial badge handling code