separated the data generating and made a more robust plot