added new variables for error detecting and validation