Removed redundant code in orderRows and orderColumns