added indexing code for MISO and 1st draft to run MISO