refactored plotting tool.