updating to use pure javascript