reorganize code for mod/config