Optimize uni size selection and rebase code

Change-Id: I91b2a8d6bbd55d2d6edffd7ac7836f389a977ab6
Signed-off-by: Chloe Xu <chloe.xu@sap.com>