prepare for optimization