Made insertion of rows column-order independent