Factors out version checking into a function