generify collections and use for each loops in some places
Merge remote-tracking branch 'origin/master'