Changed the code to be consistent and easier to write plot2