Updated plotting logic