pull count number out of function