Remove unneeded argument.
Extract pattern into method.
Fix missing variable increment.