Added duration calculation