plug badges and try to improve the code a bit