Fix bugs to get Raj Goel spreadsheet code going