Added totaltime function