better ui state handling