reorgernize function in ui