logic to prevent invalid badges from being generated