#138: modal gallery performance improvements