Various javascript features

Forgot to create separate branches :/ but the commits are separate.