Major optimization

Change-Id: Ia30f96469b60197848b98e34e046156dcbca78b2