move html tags outside of loop