defining the auxiliary functions for the validation