tweaked xp alg