created main and validityCheck