refactor ugly settings initialization