Improve speed of simulation engine