Refactor app configure stuff