Rework the version parsing according to @abadger's suggestions