Remove redundant loop.
Fix tests to match new code.