Moved toc create functin to top of init