split some of the plotting routines into functions, still WIP