Windows version of optimize.