Silenced some "comparing different types"-warings in loop conditions

Also tried to optimize loop conditions where feasible: the end/size of the list/container needs not to be checked on every iteration.