another version for two step look ahead