reorganized config writing routines