changed/fixed the way plots are generated