Xquery structure changes

case statements
empty searches show warning