remove duplicate code in medal callbacks