Attemp to optimize algorithm with ResultsetManager.py