change while loops with foreach
Fix foreach loop to work only with keys
Merge pull request #38 from acidvertigo/patch-39

change while loops with foreach