cleaned up double routines
cleaned up index routines