Refactored the modal process to a more structured setup