Switch to version_compare
Cleanup some invalid assumptions; mostly a lot of null values are impossible. Added testing.