Removed querySelector check condition, and removed modalOpenedDeferred change