commented in sudo-code for badge implementation