refactor flow show/hide