adding timing function