Implemented totalPay method and made small fixes