Start implementing lending function

This commit starts adding some of the code for actually tracking the lending.