Modified the xend some to allow for better printing, and cleaned up code some.