removed ugly forloop