move start/end data computation to a utility for DRY