refactoring index into more elements