Second attempt at fixing fix to modal repeat JS