Changed things around so that we only generate the event mask
string once, since it's the same every time.