expanded count() to include deep iteration functionality