can `manipulation` be anything except `prepend` or `append`?

If not, no need for `else if`, and this line can be moved outside the conditional