simplify validating method and add documentation