refactor modal classes and reorganize file structure