changed to using a for loop to cycle through each column and find min value