debugged a little, changed so loop loops an extra time