debugged for uneven number of columns