added support for writing config file, not working yet