updated the pure javascript example