first step of reengenering libopt