Added support for automated calculation of duration