Renamed and documented the debt-settling code
Fixed a bug
Added documentation