updated sorting.py