A working simulation
misc improvements