updated code to make the rear act smarterish, slightly faster simulation times as well