Calculation and handling of loans