programmatic loan calculations