Replace bool,iterator with boost::optional