Adding xml output support through lxml.
cleaning up the checks