added timing function if run stand-alone