code clean for selection modal function