Removing redundant legacy loop which was causing order of growth to be cubic rather than quadratic