adding timeLapse function