added a vanillajs implementation