cleanup the versions object and replace some throws with asserts