added count function