Refactor ac setup a little