Xbasic scripts can be easier to read and debug if you use some simple formatting techniques.
Here are some suggestions:
Formatting Your Xbasic Scripts
Cal Locklin
Full Story