First pass at badge improvements

Supercedes #2056.