Cleaned up most of the code so that the value returned by malloc is checked. Changed XaviInternalParse to XaviParse.