updated to automatically calculate start and end years