closure in place of globalcount in datasystem class