add dynamic forest implementation. ported from JavaScript, https://github.com/mikolalysenko/dynamic-forest