first working version of particle filter