splice function