improve payment funcition