Modified to general solution
Column and rows mapping