Simplify and refactor iet.py