redundant "this.", generic containers, foreach loop

Some changes to help the clarity and safety of the code.