refactor modal creation to view