added extra checks for the required parameters