In some circumstances, a CBP officer can remove a person without a judge hearing the case. This is known as expedited removal,
There's very little, if any, way to get around the incredible discretion given to the CBP officers. What sort of training do they have? Why do we allow this to be the case, unlike the rest of the law which has several layers and opportunities for review?