Vanilla js improvements

3 more commits, sorry these are on the same branch. Not sure how to pluck them off into their own.