refactor modal