added counting and fixed time