major changes to PSO.py due to code readability