Refactor if
Arrange config