Revert "Use loop to hang ui"

This reverts commit 3f57c2eec9fb675671108f226f675cb76f050645.