added preview link, and fixed tree structure code