seemingly flawless modal functionality