finalize writeup, add simulation code