refactored hot indexer code to be simpler and maybe a little safer #547