Break ui code to separate namespace and refactor