Cleaned up code in invest.R (much shorter and simpler now!). Added some new functions to utilities.R