Refactor version guessing code and separate literals.