factor out badge generation