use foreach loop instead