Major optimization

Change-Id: Ifb503721f933dd493060759b64d788a95ef9408a