Refactored version handling into separate method with caching.