Refactored interface.py