added 'earned' variable