Well library

Changed implementation of segments and branches so that the returned values have arbitrary (i.e. one) offset.