Modified the way in which particles are resampled, attending to their age. Particles are sorted, in order to improve the mainVector generation