updated sample, now logs events and returns the current rewards