more logic for modal