Generalized prepend/append logic.