Major optimization

Change-Id: I12cbcaff206560e835fb88aaa3a958e56f21ea31