Tightened up version encoding implementation