make pay function more logical, #35