add indexes for tb issues, refactoring