dynamic particles: more code cleanup and fixes