Modified algorithm to better catch jumps