Bug 984048: Part 3 - Update algorithm. r=ehsan,khuey

--HG--
extra : rebase_source : 5e80b118faeea419cfebbc2d1060cd2a1a61bcba