End date calculation working