Made the entire simulation deterministic based on the seed.
Made minor code improvements.