code for smaller simulated examples