updated invest.R