Put loading of badge data into function.