More work towards modularizing the plotting script