refactored major version extraction

A little bit of maintainable code cleanup.

With rvm and bundler installed, run `cd .; bundle update`, then `rspec spec` to run the unit test.