Remove unnecessary outer loop