Refactor inf.py and test cleanup