Small refactoring of modal