added pay logic