If you have this method take `error_segment` as an argument, some of the nil checks become redundant.