Refractor user index code