Added time calculation (accidentally deleted)