Finished replacing ParticleManager with the functional approach.