refactor (globaltocjs): improving documentation and simplifying code