Factored out opts into before clause.

Change-Id: I1d9e384187c2f7762598c41598cddd35ce9171be