Refactor modal.