eliminated unnecessary loop