Contributed by Anuhan Torgonshar (cherry picked from commit fe2370e039e1ee980d74769ae85d67434e0993cf)