expanded max() to include deep iteration functionality