Optimization Function is done.