Refacor resume algorithm

Change-Id: I98301f7292841ee574a01308a5af398574f2352a