finish the last function