Use boost::optional

Fixes #168.