added count calculation