finished the vanilla js version