Document $code param; add missing return code for XML output