Optimized simplemode.py