updated code to create the plots