Refactor modals to support switching