Refactor modal