Simulation appears functional

Code needs a second-round check for logic errors, but this is a good
first pass