deal with function