some refactoring in extractinfo.py