use for-loop instead of counter with while-loop