modified from https://github.com/dazedsheep/DASH-JS.git