added the algorithm to look to look into the future