Add findBlockUnder helper function