added option to do global count