some optimization and fixed the time showing