First functional version of code.

Tested forwardInterests() on Matlab's command line.