Maybe I'm missing something but I don't see the point of checking the whole array if you are only using the first element after that.