Added more functions to make index code more readable.