Updated particles to sim with updates by elaser. elaser added code with permission from liero.