Major optimization

Change-Id: If5468aac8655873180c4e356871f74be440ef868