add more accurate validation and streamline tests