Make ensure_params take real objects instead of lists plus some more cleanups