sort.py modified