added Dim, IntegrateModeMedium takes into account dimension now