Rework and clean up badge related code

Change-Id: I268f60f5c9376016b7e8e982a4c2388da730f3c0
Merge "Rework and clean up badge related code"