changed lend/return logic; still have some issues
merge