Changed main code to include XDOC code