implement functions to get index of the node