refactored simulation of data and final plotting in a separate file