added count mechanism