utf-8 and indexing refactoring