Cleaned up the particle code, this will be needed for the prediction beam rewrite.