making functions for badges.js