first working version of bsoptim