Rework version checking logic