smallest value in array working