removed excess if forloop.last