[code:eng] Some refactor on the UI engine.