opt code implement