prepare to optimization