  A finite point set in $\mathbb{R}^d$ is in general position if no $d + 1$
points lie on a common hyperplane. Let $\alpha_d(N)$ be the largest integer
such that any set of $N$ points in $\mathbb{R}^d$ with no $d + 2$ members on a
common hyperplane, contains a subset of size $\alpha_d(N)$ in general position.
Using the method of hypergraph containers, Balogh and Solymosi showed that
$\alpha_2(N) < N^{5/6 + o(1)}$. In this paper, we also use the container method
to obtain new upper bounds for $\alpha_d(N)$ when $d \geq 3$. More precisely,
we show that if $d$ is odd, then $\alpha_d(N) < N^{\frac{1}{2} + \frac{1}{2d} +
o(1)}$, and if $d$ is even, we have $\alpha_d(N) < N^{\frac{1}{2} +
\frac{1}{d-1} + o(1)}$.
  We also study the classical problem of determining the maximum number
$a(d,k,n)$ of points selected from the grid $[n]^d$ such that no $k + 2$
members lie on a $k$-flat. For fixed $d$ and $k$, we show that
\begin{equation*}
  a(d,k,n)\leq O\left(n^{\frac{d}{2\lfloor
(k+2)/4\rfloor}(1-\frac{1}{2\lfloor(k+2)/4\rfloor d+1})}\right),
\end{equation*} which improves the previously best known bound of
$O\left(n^{\frac{d}{\lfloor (k + 2)/2\rfloor}}\right)$ due to Lefmann when
$k+2$ is congruent to 0 or 1 mod 4.
