Full optimization