working except for index out of range on plot