FIX: Better step-down-p support

Fixes some issues with the step-down-in-jumps procedure. Also changes how the boolean masks are handled internally by flattening them, and only restoring them on return (when necessary). This makes for fewer checks on dimensionality in the code that would otherwise be necessary.