Some generalization of the simulation code
Oops, fixed a bug
Analyze a very simple simulation