Improved trapfep.py