function finish.