First version of making dom tree