Better code structure. Badge functions abstracted.