removed looping code bug