Internal PSO functions