placed a counter for each function