remove optimize function

it isn't used and it doesn't work