refactoring simplex.py