Attempt to simplify validate code.