Added Brendan's particle code