revising optimization algorithm