add payout functions and tests