added break statement to improve speed