fix bugs, code review, do refactor, add depth fileld to set depth of index
lol fix