how does hdr work