I suppose a vanilla js version is possible? I'll need to look into this