clean up nlopt code