Added version selection logic