adding count function