Why the x in the tests ?  I am aware that, before people back in the stone age learned to use quotes, there grew up a wide-spread superstition that it was a good idea to put an x on the front of tested values (so that, if the variable expands empty, you don't get an error; albeit, if the variable expands to two words you still get an error), but I see you've used the magnificent modern technology of quoting, which makes this superstitious dead-chicken-waving redundant.