added time calculation