You're using `windowNS(window)` in a three places here, maybe we could store it in a variable?