cleaned rankMoments function such that it sorts the corners inside the function, and not in demo.py