removed local 'globalCounter' variable