Refactor UI and fix if helper