Adding time calculation and fixing rank calculation