ok functioning code just tune up the plots