Better error messages for badly constructed input