Some code cleanup around findBlockIndex