add sub function.