converting to vanillaJS