refactor and ui tweak