added type counting