Adding more debugging to solve sort order bug