refactor methods out of index