modal refactor