Implemented end date calculation