Refactor to remove the modal approach