Added checkRequired function to ensure required params are not empty.