refactored badge factory