fixed the modal issue and refactoring