Further refactoring of plotting for GUI