Formatting and authentication

Added functionality to better format returned xml and actually use the
authentication stuff now.