modal window refactor