improved append and prepend methods