getTotalCredit() needs a $data array arg as well