added plotter
corrected indexing