refactor ui init