Add and use some common functions to check required input.