Revise PSO implementation