Add loan class

Bring in the loan class from before with a few minor changes