final optimization