cleaned up the plotting routines