Divide UI and function