added timing logic