Update ui. Rewrite code a litle.