Simplified function timing code by factoring timing function into its own module