[WIP] Adding config and Format switch (json/xml)

Don't merge this yet. Still working on it.