More efficient array min function