Added refactorings to benchmark.py