Merge "Simplify some of the logic." into oc-dev am: d8b5621640 am: 41ce373022
am: 660851ca35

Change-Id: I3421f8855d92bf17ca5ca892289bfa974b3b9b64