added updatelegalargs function, have not test or implement it.