Use for in loop in stead of c style loop.