Refactor and restore some old config