Major optimization

Change-Id: Idc1a8068847ddc0587483d18a0e5772303ba71f4