added num_particles to update()