my optimizer and main code