refactoring, bugfixing, test indexing