refactored code to generate an array of generated plots, making program interraction more JSON-like