finish define function