put back validation and max_code