Figuring out how callback functions work