Update function to take 2d array as argument
Updated