Replace variable func with counter for readability