move down_count definition out of loop