cleaned up the particles code