Improve for..in array loop