Optimized convert.py