refectoring
check index