Update NMS stuff

Those 3 merge commits are ugly, but I blame GitHub.
Yay for correct internal code!