remove outer_fold and fold, rename partial_fold to outer_fold, and clean up inner/outer fold code a bit. Fix #171