Move reverse sorting to sorted function

Remove list.reverse operation and used sorted(reverse=True) instead.