Updated code for plots