the logic is ok
next: UI and fix flaw