Extended visitor pattern example, Added singleton pattern (incremental counter)