Major optimization

Change-Id: Ie63b9dd48476a15a12e9917455beec93ee6c197e